package com.sense.kukoo.common.utils;



import androidx.annotation.IntDef;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
 *<br> Description: 打包时的环境配置值
 *<br> Author:      Lionszhang
 *<br> Date:        2018/3/6 18:38
 */
public class AppConfig {

    public static final int TYPE_RELEASE = 1;
    public static final int TYPE_ALPHA   = 2;
    public static final int TYPE_DEBUG   = 3;

    /** 构建时的变体 */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef({TYPE_RELEASE, TYPE_ALPHA, TYPE_DEBUG})
    public @interface BuildEnum {}

    @BuildEnum
    private static int sBuildType;

    /**
     * <br> Description: 设置构建类型
     * <br> Author:      Lionszhang
     * <br> Date:        2018/3/6 18:02
     */
    public static void init(@BuildEnum int buildType) {
      sBuildType = buildType;
    }

    /**
     * <br> Description: 当前的变体
     * <br> Author:      Lionszhang
     * <br> Date:        2018/3/6 18:06
     */
    @BuildEnum
    public static int getBuildType() {
        return sBuildType;
    }

    /**
     * <br> Description: 使用测试签名时，都会返回true
     * <br> Author:      Lionszhang
     * <br> Date:        2018/3/6 18:01
     */
    public static boolean isDebugKey() {
        return sBuildType == TYPE_DEBUG;
    }

    /**
     * <br> Description: 使用正式签名时，都会返回true
     * <br> Author:      Lionszhang
     * <br> Date:        2018/3/13 18:20
     */
    public static boolean isReleaseKey() {
        return sBuildType == TYPE_RELEASE || sBuildType == TYPE_ALPHA;
    }
}
